#!/bin/bash
# $1 is filename, maybe blah.part or blah.part01.rar
# $2 is pwd, default is tehparadox.com
mypwd=${2:-tehparadox.com}
if [ -f "$1" ]; then
    myfn="$1"
elif [ -f "$101.rar" ]; then
    myfn="$101.rar"
elif [ -f "$11.rar" ]; then
    myfn="$11.rar"
else
    echo Cant find file $1 or $101.rar
fi
unrar lb -v -p"$mypwd" "$myfn" 2>&1 | grep "not find"
[ $? -eq 0 ] && exit 1
echo A|unrar x -p"$mypwd" -x"*.url" -x"*.nfo" "$myfn"
[ $? -eq 0 ] && rm "$1"*.rar
